22BS

Technical details

Show code
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))

Settings used

Show code
kable(gpr)
include gdl_id crop_start crop_end thr_dur extent_N extent_W extent_S extent_E map_scale map_max_sample map_margin prob_map_s prob_map_thr shift_k calib_lon calib_lat calib_1_start calib_1_end calib_2_start calib_2_end calib_2_lon calib_2_lat prob_light_w thr_prob_percentile thr_gs RingNo scientific_name common_name mass wing_span Color
TRUE 22BS 1900-01-01 2100-01-01 12 50 20 -35 120 2 300 30 1 0.9 21600 110.83 48.57 2018-07-15 2018-08-19 NA NA NA NA 0.1 0.9 120 NA NA Eurasian Nightjar NA NA NA

Pressure timeserie

Show code
pressure_na <- pam$pressure %>%
  mutate(obs = ifelse(isoutliar | sta_id == 0, NA, obs))
p <- ggplot() +
  geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
  geom_point(data = subset(pam$pressure, isoutliar), aes(x = date, y = obs), colour = "black") +
  # geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
  geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id>0), aes(x = date, y = pressure0, col = factor(sta_id))) +
  theme_bw() +
  scale_colour_manual(values = col) +
  scale_y_continuous(name = "Pressure(hPa)")

ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)

Light

Show code
raw_geolight <- pam$light %>%
  transmute(
    Date = date,
    Light = obs
  )
lightImage(tagdata = raw_geolight, offset = 0)
tsimagePoints(twl$twilight,
  offset = 0, pch = 16, cex = 1.2,
  col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)

Show code
hist(z, freq = F)
lines(fit_z, col = "red")

Show code
li_s <- list()
l <- leaflet(width = "100%") %>%
  addProviderTiles(providers$Stamen.TerrainBackground) %>%
  addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
  i_s <- metadata(light_prob[[i_r]])$sta_id
  info <- pam$sta[pam$sta$sta_id == i_s, ]
  info_str <- paste0(i_s, " | ", info$start, "->", info$end)
  li_s <- append(li_s, info_str)
  l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
  addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
  addLayersControl(
    overlayGroups = li_s,
    options = layersControlOptions(collapsed = FALSE)
  ) %>%
  hideGroup(tail(li_s, length(li_s) - 1))

GeoPressureViz

To visualize the path on GeoPressureViz, you will need to also load the pressure and light probability map and align them first with the code below.

Show code
sta_marginal <- unlist(lapply(static_prob_marginal, function(x) raster::metadata(x)$sta_id))
sta_pres <- unlist(lapply(pressure_prob, function(x) raster::metadata(x)$sta_id))
sta_light <- unlist(lapply(light_prob, function(x) raster::metadata(x)$sta_id))
pressure_prob <- pressure_prob[sta_pres %in% sta_marginal]
light_prob <- light_prob[sta_light %in% sta_marginal]

The code below will open with the shortest path computed with the graph approach. You can change it to

Show code
geopressureviz <- list(
  pam_data = pam,
  static_prob = static_prob,
  static_prob_marginal = static_prob_marginal,
  pressure_prob = pressure_prob,
  light_prob = light_prob,
  pressure_timeserie = shortest_path_timeserie
)
save(geopressureviz, file = "~/geopressureviz.RData")

shiny::runApp(system.file("geopressureviz", package = "GeoPressureR"),
  launch.browser = getOption("browser")
)

Stationay period information

Show code
pam$sta %>% kable()
start end sta_id
2018-07-15 00:00:00 2018-08-19 16:10:00 1
2018-08-19 19:05:00 2018-08-19 19:55:00 2
2018-08-19 20:25:00 2018-08-20 14:35:00 3
2018-08-20 16:15:00 2018-08-22 12:25:00 4
2018-08-22 12:45:00 2018-08-27 13:25:00 5
2018-08-27 20:25:00 2018-08-28 12:15:00 6
2018-08-28 12:35:00 2018-08-29 12:10:00 7
2018-08-29 20:30:00 2018-08-30 14:45:00 8
2018-08-30 14:50:00 2018-08-31 13:25:00 9
2018-08-31 15:50:00 2018-09-01 20:30:00 10
2018-09-01 21:35:00 2018-09-02 15:20:00 11
2018-09-02 18:55:00 2018-09-03 17:35:00 12
2018-09-03 17:45:00 2018-09-05 13:35:00 13
2018-09-05 22:30:00 2018-09-06 13:40:00 14
2018-09-06 22:40:00 2018-09-07 13:55:00 15
2018-09-07 23:25:00 2018-09-08 13:30:00 16
2018-09-08 22:05:00 2018-09-09 13:40:00 17
2018-09-09 23:45:00 2018-09-10 14:50:00 18
2018-09-10 22:30:00 2018-09-11 13:45:00 19
2018-09-11 14:20:00 2018-09-14 23:35:00 20
2018-09-15 00:10:00 2018-09-15 13:35:00 21
2018-09-15 13:50:00 2018-09-20 16:45:00 22
2018-09-20 16:55:00 2018-09-21 13:30:00 23
2018-09-21 14:40:00 2018-09-21 23:35:00 24
2018-09-22 00:05:00 2018-09-23 23:15:00 25
2018-09-24 00:05:00 2018-09-27 18:15:00 26
2018-09-27 23:35:00 2018-09-28 13:45:00 27
2018-09-29 00:05:00 2018-09-29 13:50:00 28
2018-09-29 23:50:00 2018-09-30 14:10:00 29
2018-10-01 00:55:00 2018-10-01 14:35:00 30
2018-10-02 00:15:00 2018-10-02 14:10:00 31
2018-10-03 01:10:00 2018-10-03 16:30:00 32
2018-10-03 18:05:00 2018-10-04 14:05:00 33
2018-10-04 22:45:00 2018-10-05 14:15:00 34
2018-10-06 01:25:00 2018-10-06 14:45:00 35
2018-10-06 21:45:00 2018-10-07 15:10:00 36
2018-10-08 01:50:00 2018-10-08 15:30:00 37
2018-10-09 01:55:00 2018-10-09 15:40:00 38
2018-10-10 01:40:00 2018-10-16 23:20:00 39
2018-10-17 00:10:00 2018-10-22 14:55:00 40
2018-10-22 20:00:00 2018-10-23 14:55:00 41
2018-10-23 15:25:00 2018-10-24 00:55:00 42
2018-10-24 02:15:00 2018-10-24 14:55:00 43
2018-10-24 17:25:00 2018-10-25 00:35:00 44
2018-10-25 02:20:00 2018-10-25 15:00:00 45
2018-10-25 15:15:00 2018-10-26 01:15:00 46
2018-10-26 02:25:00 2018-10-26 21:05:00 47
2018-10-26 22:10:00 2018-10-27 15:00:00 48
2018-10-27 15:20:00 2018-10-28 01:40:00 49
2018-10-28 02:20:00 2018-10-28 15:00:00 50
2018-10-28 18:30:00 2018-10-31 16:05:00 51
2018-11-01 01:50:00 2018-11-01 17:45:00 52
2018-11-01 20:35:00 2018-11-02 17:50:00 53
2018-11-03 01:10:00 2018-11-05 21:35:00 54
2018-11-05 21:40:00 2018-11-06 22:45:00 55
2018-11-06 22:55:00 2018-11-07 18:15:00 56
2018-11-07 18:45:00 2018-11-08 20:30:00 57
2018-11-08 20:40:00 2018-11-09 15:30:00 58
2018-11-09 15:50:00 2018-11-10 02:20:00 59
2018-11-10 02:45:00 2018-11-10 15:30:00 60
2018-11-10 16:05:00 2018-11-10 23:45:00 61
2018-11-11 00:30:00 2018-11-17 15:35:00 62
2018-11-17 17:05:00 2018-11-18 01:30:00 63
2018-11-18 02:35:00 2018-11-18 15:40:00 64
2018-11-18 15:55:00 2018-11-19 02:20:00 65
2018-11-19 02:30:00 2018-11-19 16:30:00 66
2018-11-20 02:25:00 2018-11-20 17:25:00 67
2018-11-20 23:00:00 2018-11-21 22:15:00 68
2018-11-22 02:25:00 2018-11-22 18:05:00 69
2018-11-23 02:05:00 2018-11-23 18:45:00 70
2018-11-24 01:40:00 2018-11-24 16:15:00 71
2018-11-24 21:35:00 2018-11-25 18:25:00 72
2018-11-25 19:25:00 2018-11-26 20:15:00 73
2018-11-26 20:40:00 2018-11-27 02:05:00 74
2018-11-27 02:10:00 2019-03-14 20:20:00 75
2019-03-15 03:15:00 2019-03-15 22:35:00 76
2019-03-16 00:45:00 2019-03-16 16:10:00 77
2019-03-16 16:30:00 2019-03-16 23:30:00 78
2019-03-17 00:25:00 2019-03-17 16:15:00 79
2019-03-17 16:25:00 2019-03-18 03:40:00 80
2019-03-18 03:40:00 2019-03-18 16:10:00 81
2019-03-18 16:25:00 2019-03-19 16:15:00 82
2019-03-19 16:40:00 2019-03-20 16:15:00 83
2019-03-21 02:20:00 2019-03-21 15:40:00 84
2019-03-21 16:05:00 2019-03-22 15:55:00 85
2019-03-23 02:50:00 2019-03-23 15:55:00 86
2019-03-24 02:55:00 2019-03-24 15:55:00 87
2019-03-25 02:20:00 2019-03-25 16:00:00 88
2019-03-26 01:10:00 2019-03-26 18:35:00 89
2019-03-26 20:50:00 2019-03-27 16:50:00 90
2019-03-27 21:00:00 2019-03-28 20:50:00 91
2019-03-28 22:10:00 2019-03-30 19:15:00 92
2019-03-30 20:50:00 2019-03-31 12:40:00 93